clc,clear;
close all;
warning off;
%导入数据
[~,name]=xlsread('newdata.xlsx');
data=readmatrix('newdata.xlsx');
data(isnan(data))=10000;%为方便看
%画出时间趋势图(各自的)
% for i=3:size(data,2)
%     matu(data(:,1),data(:,i),name(1,i))
% end
%求年均增长率
num=data(end,1)-data(1,1)+1;
j=1;
for i=3:size(data,2)
    sprto(j)=(data(end,i)/data(1,i)).^(1/num)-1;
    j=j+1;
end
[x0,index]=sort(sprto,'descend');
names=name(1,index+2);%增长排名
%作图(年均增长率)
figure
hold on
bar(x0*100)
% 设置x轴标签
set(gca, 'XTick',1:31,'XTickLabel', names);
ylabel('年均增长率%')
xtickangle(60);

function p=matu(x,y,name)
     %作图
     figure
     plot(x,y)
     xlabel('年份')
     ylabel('医疗卫生机构的数量')
     title([cell2mat(name),'时间趋势图'])
     hold on
end